package mi.payment.utils.iso8583;

import java.io.Serializable;

public class MsgField implements Serializable {

    private int fieldPos;           // 哪个域
    private int lengthType;         // 是否变长0 不是 2 两位变长 3 三位变长
    private int lengthTypeEncode;   // bcd ascii

    private int dataType;           // 数据类型 SDK_8583_DATA_BCD = 0;SDK_8583_DATA_BIT = 1;SDK_8583_DATA_ASC = 2;
    private int alignType;          // 对齐方式
    private int fillChar;           // 对齐时，不足填充字符
    private int dataLength;         // 数据长度

    private String dataStr;
    private byte[] dataBytes;       // 数据

    public void setAlignType(int alignType) {
        this.alignType = alignType;
    }

    public void setFillChar(int fillChar) {
        this.fillChar = fillChar;
    }

    public int getAlignType() {
        return alignType;
    }

    public int getFillChar() {
        return fillChar;
    }

    public void setFieldPos(int fieldPos) {
        this.fieldPos = fieldPos;
    }

    public void setLengthType(int lengthType) {
        this.lengthType = lengthType;
    }

    public void setLengthTypeEncode(int lengthTypeEncode) {
        this.lengthTypeEncode = lengthTypeEncode;
    }

    public void setDataType(int dataType) {
        this.dataType = dataType;
    }

    public void setDataLength(int dataLength) {
        this.dataLength = dataLength;
    }

    public void setDataBytes(byte[] dataBytes) {
        this.dataBytes = new byte[dataBytes.length];
        System.arraycopy(dataBytes, 0, this.dataBytes, 0, dataBytes.length);
    }

    public void setDataStr(String dataStr) {
        this.dataStr = dataStr;
        if (lengthType > 0) {
            int length = dataStr.length();
            setDataLength(length);
        }
    }

    public int getFieldPos() {
        return fieldPos;
    }

    public int getLengthType() {
        return lengthType;
    }

    public int getLengthTypeEncode() {
        return lengthTypeEncode;
    }

    public int getDataType() {
        return dataType;
    }

    public int getDataLength() {
        return dataLength;
    }

    public byte[] getDataBytes() {
        return dataBytes;
    }

    public String getDataStr() {
        return dataStr;
    }


}
